package com.neusoft.service.impl;

import com.neusoft.entity.Disease;
import com.neusoft.entity.MedicalRecordDisease;
import com.neusoft.mapper.MedicalRecordDiseaseMapper;
import com.neusoft.service.MedicalRecordDiseaseService;
import com.neusoft.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author akemihomurasama
 */
@Service
public class MedicalRecordDiseaseServiceImpl implements MedicalRecordDiseaseService {
    @Autowired
    private MedicalRecordDiseaseMapper medicalRecordDiseaseMapper;

    /**
     * 保存患者疾病关联信息
     *
     * @param diseaseList 关联信息
     * @param medicalRecordId 病历首页id
     * @return 添加结果
     */
    @Override
    public Result addDiseaseForPatient(List<Disease> diseaseList,int medicalRecordId) {
        medicalRecordDiseaseMapper.addDiseaseForPatient(diseaseList,medicalRecordId);
        return Result.ok();
    }

    /**
     * 根据疾病id列表和患者病历首页id批量删除患者疾病
     *
     * @param diseaseIdList 疾病id列表
     * @param recordId      患者病历首页id
     * @return 更新结果
     */
    @Override
    public Result deleteDiseaseByRecordIdDiseaseId(List<Integer> diseaseIdList, int recordId) {
        medicalRecordDiseaseMapper.deleteDiseaseByRecordIdDiseaseId(diseaseIdList, recordId);
        return Result.ok();
    }
}
